package com.ruoyi.aidesign.controller;

import com.ruoyi.aidesign.model.HouseDesignRequest;
import com.ruoyi.aidesign.websocket.DesignDialogueWebSocket;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 设计对话控制器
 */
@RestController
@RequestMapping("/aidesign")
public class DesignDialogueController {

    /**
     * 获取WebSocket连接信息
     */
    @GetMapping("/websocket/info")
    public ResponseEntity<Map<String, Object>> getWebSocketInfo() {
        Map<String, Object> info = new HashMap<>();
        info.put("endpoint", "/aidesign/dialogue");
        info.put("onlineCount", DesignDialogueWebSocket.getOnlineCount());
        info.put("status", "active");
        return ResponseEntity.ok(info);
    }

    /**
     * 测试接口，用于验证设计请求数据
     */
    @PostMapping("/test")
    public ResponseEntity<Map<String, Object>> testDesignRequest(@RequestBody HouseDesignRequest request) {
        Map<String, Object> response = new HashMap<>();
        
        response.put("status", "success");
        response.put("message", "请求数据有效");
        response.put("data", request);
        
        return ResponseEntity.ok(response);
    }
} 